
<%@ page import = "clothing.database.Employee" %>
<%@ page import = "java.util.ArrayList" %>
<%@page import = "clothing.database.EmployeeManager" %>
<%@ include file = "templates/header.jsp" %>

<%
String id =request.getParameter("id2");
System.out.println("edit "+id);

int iid = Integer.parseInt(id);
EmployeeManager em = new EmployeeManager();
Employee editEmployee = em.getEmployee(iid);
String firstname = editEmployee.getFirstName();
String lastname = editEmployee.getLastName();
String mi = editEmployee.getMI();
String phone = editEmployee.getPhone();
String address = editEmployee.getAddress();
String username = editEmployee.getUsername();
String password = editEmployee.getPassword();
String emp_man = editEmployee.getType();

%>


<h3> Edit Employee Page </h3>

<script>
function process(a)
{
		document.getElementById('id').value=a;
		document.myform.submit();
}  
</script>
   
	
<h2> Edit an Employee </h2>
<form name="myform" id="myform" action ="updateEmployee.jsp" method = "post" >
	<table>
		<tr>
            <td>Employee ID</td>
            <% out.println("<td name=\"uid\" value=\""+id+"\">"+id+"</td>"); %>
            
            
        </tr>
        <tr>
			<td>First Name: </td>           
            <% out.println("<td><input name=\"firstname\" value=\""+firstname+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>MI: </td>           
            <% out.println("<td><input name=\"mi\" value=\""+mi+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>Last Name: </td>           
            <% out.println("<td><input name=\"lastname\" value=\""+lastname+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>Phone: </td>           
            <% out.println("<td><input name=\"phone\" value=\""+phone+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>Address: </td>           
            <% out.println("<td><input name=\"address\" value=\""+address+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>User Name: </td>           
            <% out.println("<td><input name=\"username\" value=\""+username+"\"></td>"); %>
                 
		</tr>
        <tr>
			<td>Password: </td>           
            <% out.println("<td><input name=\"password\" value=\""+password+"\"></td>"); %>
                 
		</tr>
       <tr>
		<td>Type:</td>
		<td>
                   <select name="type" />
                   <option value="Employee">Employee</option>
                   <option value="Manager">Manager</option>
                   </select>
                   
            </td>
	  </tr>
       
      
    <tr>
			<td> </td><td><input type="submit" value= "submit" onclick = "process(<%= id %>);" /></td>
		</tr>
    <input type="hidden" name ="id" id = "id" />
</table>
</form>

<%@ include file = "templates/footer.jsp" %>


